package com.cheng.service;

import javax.jms.MapMessage;
import javax.jms.Message;
import javax.jms.MessageListener;
import org.springframework.stereotype.Service;

import com.cheng.bos.foreUtils.SmsUtils;

@Service("telephoneCodeService")
public class TelephoneCodeService implements MessageListener {

	@Override
	public void onMessage(Message message) {
		try {
			MapMessage mapMessage = (MapMessage) message;
			String telephone = mapMessage.getString("telephone");
			String mesg = mapMessage.getString("mesg");
			String result = SmsUtils.sendSmsByHTTP(telephone, mesg);
			if (result.startsWith("000")) {
System.out.println("手机验证码发送成功!");
			}else{
System.out.println(result);
System.out.println(mesg);
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
}
